<?php
//var_dump($_POST);
$ClassId = $_POST['ClassId'] ?? '';
$ClassName = $_POST['ClassName'] ?? '';

// 连接数据库
$dsn = "sqlsrv:Server=localhost;Database=Student";
$db = new PDO($dsn, "sa", "123456");

$sql = "update Class set ClassName='{$ClassName}' where ClassId ='{$ClassId}';";
$result = $db->exec($sql);
var_dump($db->errorInfo()); // 排查数据库错误。
if ($result) {
    echo '修改成功, <a href="class_list.php">返回列表页</a>';
} else{
    echo '修改失败';
}

